﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Event.Default;
using Peak.Core;
using NHibernate.Event;

namespace Peak.Data
{
  public class PreLoadEventListener : DefaultPreLoadEventListener
  {
    public override void OnPreLoad(PreLoadEvent @event)
    {
      if (@event.Entity is IHasBusinessRules)
      {
        (@event.Entity as IHasBusinessRules).SetRulesEnabled(false);
      }
      base.OnPreLoad(@event);
    }
  }
}
